package electrycity;


import org.apache.hadoop.io.Writable;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;


public class ElectricWritable implements Writable {
    private double cf = 0;
    private double xy = 0;
    private double kt = 0;
    private double sum = 0;

    public ElectricWritable() {
    }

    public ElectricWritable(double cf, double xy, double kt, double sum) {
        this.cf = cf;
        this.kt = kt;
        this.xy = xy;
        this.sum = sum;
    }

    public double getCf() {

        return cf;
    }

    public void setCf(double cf) {

        this.cf = cf;
    }

    public double getXy() {
        return xy;
    }

    public void setXy(double xy) {
        this.xy = xy;
    }

    public double getKt() {
        return kt;
    }

    public void setKt(double kt) {
        this.kt = kt;
    }

    public double getSum() {
        return sum;
    }

    public void setSum(double sum) {
        this.sum = sum;
    }

    @Override
    public void write(DataOutput out) throws IOException {
        out.writeDouble(cf);
        out.writeDouble(xy);
        out.writeDouble(kt);
        out.writeDouble(sum);
    }

    @Override
    public void readFields(DataInput in) throws IOException {
        cf = in.readDouble();
        xy = in.readDouble();
        kt = in.readDouble();
        sum = in.readDouble();
    }

    @Override
    public String toString() {
        return cf + "\t" + xy + "\t" + kt + "\t" + sum;
    }
}

